package models.base;

import admin.AdminUser;
import enums.DeletedStatus;
import models.uuid.UUIDModel;

import javax.persistence.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@MappedSuperclass
public class BaseModel extends UUIDModel{

    //创建日期
    @Column(name = "create_at")
    @Temporal(TemporalType.TIMESTAMP)
    public Date createAt = new Date();

    /**
     * 创建人.
     */
    @ManyToOne
    @JoinColumn(name = "create_user_id")
    public AdminUser createUser;

    //最后修改日期
    @Column(name = "modify_at")
    @Temporal(TemporalType.TIMESTAMP)
    public Date modifyAt;


    /**
     * 修改人.
     */
    @ManyToOne
    @JoinColumn(name = "modify_user_id")
    public AdminUser modifyUser;


    /**
     * 逻辑删除,0:未删除，1:已删除
     */
    @Enumerated(EnumType.ORDINAL)
    @Column(name = "deleted")
    public DeletedStatus deleted = DeletedStatus.UN_DELETED;

    @Transient
    protected Map<String,Object> extMap = new HashMap<String,Object>();


}
